<script setup>
import { RouterLink, RouterView } from 'vue-router'
</script>

<template>
  <header>
    <div class="wrapper">
      <nav>
        <RouterLink to="/" class="nav-logo">人生成长指南</RouterLink>
        <div class="nav-links">
          <RouterLink to="/cognition">提升认知</RouterLink>
          <RouterLink to="/fitness">健身</RouterLink>
          <RouterLink to="/knowledge">知识学习</RouterLink>
          <RouterLink to="/socialization">社会化进程</RouterLink>
          <RouterLink to="/about">关于我们</RouterLink>
        </div>
      </nav>
    </div>
  </header>

  <main>
    <RouterView class="router-view" />
  </main>
</template>

<style scoped>
header {
  line-height: 1.5;
  background-color: var(--color-background-soft);
  padding: 1rem 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  max-width: 1400px;
  margin: 0 auto;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--vt-c-indigo);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
  transition: color 0.3s;
  padding: 0.5rem 1rem;
  border-radius: 4px;
}

.nav-links a:hover {
  background-color: var(--vt-c-indigo);
  color: white;
}

.nav-links a.router-link-exact-active {
  background-color: var(--vt-c-indigo);
  color: white;
}

@media (max-width: 768px) {
  .nav-links {
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    width: 100%;
  }
  
  nav {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* 确保内容区域在导航栏下方并占据全屏 */
main {
  margin-top: 80px; /* 与导航栏高度相匹配 */
  min-height: calc(100vh - 80px);
  width: 100%;
}

/* 调整RouterView的样式 */
.router-view {
  min-height: 100%;
  width: 100%;
}
</style>
